﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
namespace MyUtility
{
    public partial class SendSMSPage : PhoneApplicationPage
    {
        public SendSMSPage()
        {
            InitializeComponent();
        }

        private void bntSendSMS_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	// TODO: Add event handler implementation here.
			SmsComposeTask sms = new SmsComposeTask();
			//EmailComposeTask
			sms.To = txtPhuneNumber.Text;
			sms.Body = txtBody.Text;
			sms.Show();
        }

        private void bntSelectPhoneNumber_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	// TODO: Add event handler implementation here.
			PhoneNumberChooserTask number = new PhoneNumberChooserTask();
			//EmailAddressChooserTask
			number.Completed +=new System.EventHandler<Microsoft.Phone.Tasks.PhoneNumberResult>(number_Completed);
			number.Show();
        }

        private void number_Completed(object sender, Microsoft.Phone.Tasks.PhoneNumberResult e)
        {
        	// TODO: Add event handler implementation here.
			if(e.TaskResult == TaskResult.OK){
				txtPhuneNumber.Text = e.PhoneNumber;
			}
        }
    }
}
